/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fatecpg.sextociclo.domain.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;

/**
 *
 * @author amorimjj
 */
@Entity
@Table(name="tbClient")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="cdType",discriminatorType=DiscriminatorType.STRING)
@DiscriminatorValue("CC")
public class Client implements Serializable {
    
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    @Column(name="cdClient")
    private int id;
    
    @Column(name="strName")
    private String name;
    
    @Embedded
    @AttributeOverrides(
    {
        @AttributeOverride(name="street",column=@Column(name="strStreet")),
        @AttributeOverride(name="number",column=@Column(name="cdNumber"))
    })
    private Address address;
    
    @Column(name="strSponsor")
    private String sponsor;
    
    @OneToMany(cascade=CascadeType.ALL,mappedBy="client")
    private Collection<Project> projects;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public Address getAddress() {
        return address;
    }

    public void setAddress(Address address) {
        this.address = address;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Collection<Project> getProjects() {
        return projects;
    }

    public void setProjects(Collection<Project> projects) {
        this.projects = projects;
    }

    public String getSponsor() {
        return sponsor;
    }

    public void setSponsor(String sponsor) {
        this.sponsor = sponsor;
    }
    
}
